﻿// Copyright (c) 2012 - 2020 Jared Zheng <jaredz at outlook dot com>
// Buddha Framework is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Create : 2012-12-01 version 0.1 Jared Zheng <jaredz at outlook dot com>
// Update : 2018-12-05 version 3.1.5 Jared Zheng <jaredz at outlook dot com>

#ifndef __MASTERDB_HANDLER_H__
#define __MASTERDB_HANDLER_H__

#pragma once

#include "CommonHandler.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// 业务数据服务器处理
class CMasterDBHandler : public CCommonHandler
{
public:
    CMasterDBHandler(void);
    virtual ~CMasterDBHandler(void);
private:
    virtual void OnLive(bool bStart) OVERRIDE;
    virtual void OnLink(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnUpdate(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, uintptr_t utData) OVERRIDE;
    virtual void OnSync(Int nServerIndex, CStream& Stream) OVERRIDE;
    virtual void OnUnlink(Int nServerIndex, uintptr_t utData) OVERRIDE;

    virtual void UpdateServerInfo(void) OVERRIDE;

    virtual PCXStr GetName(void) OVERRIDE;
private:
    UInt   m_uMasterDBServer;
    UInt   m_uMasterDBQuery;
    UInt   m_uMasterDBLoad;
    UInt   m_uMasterCount;
    UInt   m_uMasterGate;
    UInt   m_uMasterService;
    UInt   m_uServiceCount;
    UInt   m_uServiceOnline;
    UInt   m_uServiceTotal;
};

#endif // __MASTERDB_HANDLER_H__
